from os import path

from loguru import logger

from core.config import settings


def set_log():
    logger.remove()

    logger.add(
        sink=path.join(settings.LOG_DIR, "error_{time}.log"),
        format=settings.LOG_FORMATE,
        rotation=settings.LOG_ROTATION,
        level="ERROR",
        enqueue=True,
    )

    logger.add(
        sink=path.join(settings.LOG_DIR, "debug_{time}.log"),
        format=settings.LOG_FORMATE,
        rotation=settings.LOG_ROTATION,
        level="DEBUG",
        enqueue=True,
    )
